﻿using System;
using UnityEngine;

// Token: 0x02000004 RID: 4
public class ArenaTeleportScript : MonoBehaviour
{
	// Token: 0x06000008 RID: 8 RVA: 0x00002CAF File Offset: 0x00000EAF
	private void Start()
	{
		this.coll = base.GetComponent<BoxCollider2D>();
	}

	// Token: 0x06000009 RID: 9 RVA: 0x00002CC0 File Offset: 0x00000EC0
	private void Update()
	{
		this.checkTime -= Time.deltaTime;
		if (this.checkTime < 0f)
		{
			this.checkTime = 0.75f;
			Collider2D[] array = Physics2D.OverlapBoxAll(base.transform.position, this.coll.size, base.transform.eulerAngles.z, LayerMask.GetMask(new string[]
			{
				"Grunt"
			}));
			int i = 0;
			while (i < array.Length)
			{
				Collider2D collider2D = array[i];
				MonoBehaviour.print(collider2D.name);
				DamageReceiver damageReceiver;
				if (collider2D.TryGetComponent<DamageReceiver>(out damageReceiver))
				{
					Vector2 v = this.teleportPos - damageReceiver.body.torso.transform.position;
					damageReceiver.body.transform.position += v;
					damageReceiver.body.health *= 0.7f;
					if (damageReceiver.body.held)
					{
						damageReceiver.body.held.transform.position += v;
						return;
					}
					break;
				}
				else
				{
					i++;
				}
			}
		}
	}

	// Token: 0x04000019 RID: 25
	public Vector2 teleportPos;

	// Token: 0x0400001A RID: 26
	private float checkTime;

	// Token: 0x0400001B RID: 27
	private BoxCollider2D coll;
}
